package com.yao.mymvc.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Henry Yao
 */
public abstract class AbstractHttpServlet extends HttpServlet {
    /**
     * 抽象魔板方法模式
     * @param req
     * @param resp
     * @throws ServletException
     * @throws IOException
     */
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doDispatch(req,resp);
    }

    /**
     * 交由子类实现
     * @param req
     * @param resp
     */
    protected abstract void doDispatch(HttpServletRequest req, HttpServletResponse resp);


}
